<?php

Route::group(['namespace'=>'Admin','prefix'=>'admin'],function (){
    //登录、注销
    Route::get('login','LoginController@showLoginForm')->name('admin.loginForm');
    Route::post('login','LoginController@login')->name('admin.login');
    Route::get('logout','LoginController@logout')->name('admin.logout');

});

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| 后台需要授权的路由 admins
|
*/
Route::group(['namespace'=>'Admin','prefix'=>'admin','middleware'=>['auth','permission']],function (){
    //后台布局
    Route::get('/','IndexController@layout')->name('admin.layout');
    //后台首页
    Route::get('/index','IndexController@index')->name('admin.index');
    Route::get('/index1','IndexController@index1')->name('admin.index1');
    Route::get('/index2','IndexController@index2')->name('admin.index2');
    //图标
    Route::get('icons','IndexController@icons')->name('admin.icons');



    //文章管理
    Route::prefix('posts')->group(function () {
        Route::get('data', 'PostsController@data')->name('admin.posts.data');
        Route::get('/', 'PostsController@index')->name('admin.posts');

        //添加
        Route::get('create', 'PostsController@create')->name('admin.posts.create');
        Route::post('store', 'PostsController@store')->name('admin.posts.store');
        //编辑
        Route::get('edit/{id}/', 'PostsController@edit')->name('admin.posts.edit');
        Route::put('update/{id}', 'PostsController@update')->name('admin.posts.update');
        //删除
        Route::delete('posts/destroy', 'PostsController@destroy')->name('admin.posts.destroy');

        Route::get('recycle', 'PostsController@recycle')->name('admin.posts.recycle');
        Route::any('restore', 'PostsController@restore')->name('admin.posts.restore');
        Route::any('meta/del', 'PostsController@metaDel')->name('admin.posts.metadel');

    });



    //页面管理
    Route::prefix('pages')->group(function () {
        Route::get('data', 'PagesController@data')->name('admin.pages.data');
        Route::get('/', 'PagesController@index')->name('admin.pages');
        //添加
        Route::get('create', 'PagesController@create')->name('admin.pages.create');
        Route::post('store', 'PagesController@store')->name('admin.pages.store');
        //编辑r
        Route::get('edit/{id}', 'PagesController@edit')->name('admin.pages.edit');
        Route::put('update/{id}', 'PagesController@update')->name('admin.pages.update');
        //删除
        Route::delete('destroy', 'PagesController@destroy')->name('admin.pages.destroy');
    });

    //配置管理
    Route::prefix('configs')->group(function () {
        Route::get('data', 'ConfigsController@data')->name('admin.configs.data');
        Route::get('/', 'ConfigsController@index')->name('admin.configs');
        //添加
        Route::get('create', 'ConfigsController@create')->name('admin.configs.create');
        Route::post('store', 'ConfigsController@store')->name('admin.configs.store');
        //编辑
        Route::get('edit/{id}', 'ConfigsController@edit')->name('admin.configs.edit');
        Route::put('update/{id}', 'ConfigsController@update')->name('admin.configs.update');
        //删除
        Route::delete('destroy', 'ConfigsController@destroy')->name('admin.configs.destroy');

        Route::get('base', 'ConfigsController@base')->name('admin.configs.base');
        Route::post('save', 'ConfigsController@save')->name('admin.configs.save');
    });




    //分类管理
    Route::get('category/data', 'CategoryController@data')->name('admin.category.data');
    Route::get('category', 'CategoryController@index')->name('admin.category');
    //添加
    Route::get('category/create', 'CategoryController@create')->name('admin.category.create');
    Route::post('category/store', 'CategoryController@store')->name('admin.category.store');
    //编辑
    Route::get('category/edit/{id}/', 'CategoryController@edit')->name('admin.category.edit');
    Route::put('category/update/{id}/', 'CategoryController@update')->name('admin.category.update');
    //删除
    Route::delete('category/destroy', 'CategoryController@destroy')->name('admin.category.destroy');


    //商品参数
    Route::get('goods/params/data', 'GoodsParamsController@data')->name('admin.goods.params.data');
    Route::get('goods/params/', 'GoodsParamsController@index')->name('admin.goods.params');
    //添加
    Route::get('goods/params/create', 'GoodsParamsController@create')->name('admin.goods.params.create');
    Route::post('goods/params/store', 'GoodsParamsController@store')->name('admin.goods.params.store');
    //编辑
    Route::get('goods/params/{id}/edit', 'GoodsParamsController@edit')->name('admin.goods.params.edit');
    Route::put('goods/params/{id}/update', 'GoodsParamsController@update')->name('admin.goods.params.update');
    //删除
    Route::delete('goods/params/destroy', 'GoodsParamsController@destroy')->name('admin.goods.params.destroy');


    // 标签管理
    Route::prefix('tags')->group(function () {
        // 列表
        Route::get('data', 'TagsController@data')->name('admin.tags.data');
        Route::get('/', 'TagsController@index')->name('admin.tags');

        // 添加
        Route::get('create', 'TagsController@create')->name('admin.tags.create');
        Route::post('store', 'TagsController@store')->name('admin.tags.store');
        // 编辑
        Route::get('edit/{id}', 'TagsController@edit')->name('admin.tags.edit');
        Route::put('update/{id}', 'TagsController@update')->name('admin.tags.update');

        // 删除
        Route::delete('destroy', 'TagsController@destroy')->name('admin.tags.destroy');

    });

    // 图片管理
    Route::prefix('images')->group(function () {
        // 列表
        Route::get('data', 'ImagesController@data')->name('admin.images.data');
        Route::get('index', 'ImagesController@index')->name('admin.images');

        Route::any('manage', 'ImagesController@manage')->name('admin.images.manage');

        // 删除
        Route::delete('destroy', 'ImagesController@destroy')->name('admin.images.destroy');

    });

    //产品管理
    Route::prefix('goods')->group(function () {

        //商品管理
        Route::get('data', 'GoodsController@data')->name('admin.goods.data');
        Route::get('/', 'GoodsController@index')->name('admin.goods');
        //添加
        Route::get('create', 'GoodsController@create')->name('admin.goods.create');
        Route::post('store', 'GoodsController@store')->name('admin.goods.store');
        //编辑
        Route::get('edit/{id}', 'GoodsController@edit')->name('admin.goods.edit');
        Route::put('update/{id}', 'GoodsController@update')->name('admin.goods.update');
        //删除
        Route::delete('destroy', 'GoodsController@destroy')->name('admin.goods.destroy');

        Route::get('category', 'GoodsController@category')->name('admin.goods.category');

        Route::any('splice', 'GoodsController@splice')->name('admin.goods.splice');

        // 属性管理
        Route::prefix('attributes')->group(function () {
            // 列表
            Route::get('data', 'GoodsAttributesController@data')->name('admin.goods.attributes.data');
            Route::get('/', 'GoodsAttributesController@index')->name('admin.goods.attributes');

            // 添加
            Route::get('create', 'GoodsAttributesController@create')->name('admin.goods.attributes.create');
            Route::post('store', 'GoodsAttributesController@store')->name('admin.goods.attributes.store');
            // 编辑
            Route::get('edit/{id}', 'GoodsAttributesController@edit')->name('admin.goods.attributes.edit');
            Route::put('update/{id}', 'GoodsAttributesController@update')->name('admin.goods.attributes.update');

            // 删除
            Route::delete('destroy', 'GoodsAttributesController@destroy')->name('admin.goods.attributes.destroy');
            // 恢复删除
            //Route::get('restore/{id}', 'GoodsAttributesController@restore')->name('admin.goods.attributes.');
        });

        // 类型管理
        Route::prefix('type')->group(function () {
            Route::get('params', 'GoodsTypeController@params')->name('admin.goods.type.params');
            Route::post('params/save', 'GoodsTypeController@saveParams')->name('admin.goods.type.saveParams');

            Route::post('attributes/save', 'GoodsTypeController@saveAttributes')->name('admin.goods.type.saveAttributes');
            Route::any('attributes', 'GoodsTypeController@attributes')->name('admin.goods.type.attributes');

            Route::any('item', 'GoodsTypeController@item')->name('admin.goods.type.item');


            // 列表
            Route::get('data', 'GoodsTypeController@data')->name('admin.goods.type.data');
            Route::get('/', 'GoodsTypeController@index')->name('admin.goods.type');

            // 添加
            Route::get('create', 'GoodsTypeController@create')->name('admin.goods.type.create');
            Route::post('store', 'GoodsTypeController@store')->name('admin.goods.type.store');
            // 编辑
            Route::get('edit/{id}', 'GoodsTypeController@edit')->name('admin.goods.type.edit');
            Route::put('update/{id}', 'GoodsTypeController@update')->name('admin.goods.type.update');

            // 删除
            Route::delete('destroy', 'GoodsTypeController@destroy')->name('admin.goods.type.destroy');
            // 恢复删除
            //Route::get('restore/{id}', 'GoodsAttributesController@restore')->name('admin.goods.attributes.');
        });


        // 品牌管理
        Route::prefix('brand')->group(function () {
            // 列表
            Route::get('data', 'GoodsBrandController@data')->name('admin.goods.brand.data');
            Route::get('/', 'GoodsBrandController@index')->name('admin.goods.brand');

            // 添加
            Route::get('create', 'GoodsBrandController@create')->name('admin.goods.brand.create');
            Route::post('store', 'GoodsBrandController@store')->name('admin.goods.brand.store');
            // 编辑
            Route::get('edit/{id}', 'GoodsBrandController@edit')->name('admin.goods.brand.edit');
            Route::put('update/{id}', 'GoodsBrandController@update')->name('admin.goods.brand.update');

            // 删除
            Route::delete('destroy', 'GoodsBrandController@destroy')->name('admin.goods.brand.destroy');

        });
    });



    //角色管理
    Route::prefix('roles')->group(function () {
        Route::get('data', 'RolesController@data')->name('admin.roles.data');
        Route::get('/', 'RolesController@index')->name('admin.roles');
        //添加
        Route::get('create', 'RolesController@create')->name('admin.roles.create');
        Route::post('store', 'RolesController@store')->name('admin.roles.store');
        //编辑
        Route::get('edit/{id}', 'RolesController@edit')->name('admin.roles.edit');
        Route::put('update/{id}', 'RolesController@update')->name('admin.roles.update');
        //删除
        Route::delete('destroy', 'RolesController@destroy')->name('admin.roles.destroy');
    });

    //权限管理
    Route::prefix('permissions')->group(function () {
        Route::get('data', 'PermissionsController@data')->name('admin.permissions.data');
        Route::get('/', 'PermissionsController@index')->name('admin.permissions');
        //添加
        Route::get('create', 'PermissionsController@create')->name('admin.permissions.create');
        Route::post('store', 'PermissionsController@store')->name('admin.permissions.store');
        //编辑
        Route::get('edit/{id}', 'PermissionsController@edit')->name('admin.permissions.edit');
        Route::put('update/{id}', 'PermissionsController@update')->name('admin.permissions.update');
        //删除
        Route::delete('destroy', 'PermissionsController@destroy')->name('admin.permissions.destroy');
    });

    //管理员
    Route::prefix('users')->group(function () {
        Route::get('data', 'UsersController@data')->name('admin.users.data');
        Route::get('/', 'UsersController@index')->name('admin.users');
        //添加
        Route::get('create', 'UsersController@create')->name('admin.users.create');
        Route::post('store', 'UsersController@store')->name('admin.users.store');
        //编辑
        Route::get('edit/{id}', 'UsersController@edit')->name('admin.users.edit');
        Route::put('update/{id}', 'UsersController@update')->name('admin.users.update');
        //删除
        Route::delete('destroy', 'UsersController@destroy')->name('admin.users.destroy');
    });

    //菜单
    Route::prefix('menus')->group(function () {
        Route::get('data', 'MenusController@data')->name('admin.menus.data');
        Route::get('/', 'MenusController@index')->name('admin.menus');
        //添加
        Route::get('create', 'MenusController@create')->name('admin.menus.create');
        Route::post('store', 'MenusController@store')->name('admin.menus.store');
        //编辑
        Route::get('edit/{id}', 'MenusController@edit')->name('admin.menus.edit');
        Route::put('update/{id}', 'MenusController@update')->name('admin.menus.update');
        //删除
        Route::delete('destroy', 'MenusController@destroy')->name('admin.menus.destroy');
    });


    //会员
    Route::prefix('members')->group(function () {
        Route::get('data', 'MembersController@data')->name('admin.members.data');
        Route::get('/', 'MembersController@index')->name('admin.members');
        //添加
        Route::get('create', 'MembersController@create')->name('admin.members.create');
        Route::post('store', 'MembersController@store')->name('admin.members.store');
        //编辑
        Route::get('edit/{id}', 'MembersController@edit')->name('admin.members.edit');
        Route::put('update/{id}', 'MembersController@update')->name('admin.members.update');
        //删除
        Route::delete('destroy', 'MembersController@destroy')->name('admin.members.destroy');
    });

    //门店
    Route::prefix('stores')->group(function () {
        Route::get('data', 'StoresController@data')->name('admin.stores.data');
        Route::get('/', 'StoresController@index')->name('admin.stores');
        //添加
        Route::get('create', 'StoresController@create')->name('admin.stores.create');
        Route::post('store', 'StoresController@store')->name('admin.stores.store');
        //编辑
        Route::get('edit/{id}', 'StoresController@edit')->name('admin.stores.edit');
        Route::put('update/{id}', 'StoresController@update')->name('admin.stores.update');
        //删除
        Route::delete('destroy', 'StoresController@destroy')->name('admin.stores.destroy');
    });
    //
    //微信
    Route::prefix('wechat')->group(function () {
        Route::get('data', 'WechatController@data')->name('admin.wechat.data');
        Route::get('/', 'WechatController@index')->name('admin.wechat');
        //添加
        Route::get('create', 'WechatController@create')->name('admin.wechat.create');
        Route::post('store', 'WechatController@store')->name('admin.wechat.store');
        //编辑
        Route::get('edit/{id}', 'WechatController@edit')->name('admin.wechat.edit');
        Route::put('update/{id}', 'WechatController@update')->name('admin.wechat.update');
        //删除
        Route::delete('destroy', 'WechatController@destroy')->name('admin.wechat.destroy');
    });


    //小程序
    Route::prefix('mini')->group(function () {
        Route::get('data', 'MiniProgramController@data')->name('admin.mini.data');
        Route::get('/', 'MiniProgramController@index')->name('admin.mini');
        //添加
        Route::get('create', 'MiniProgramController@create')->name('admin.mini.create');
        Route::post('store', 'MiniProgramController@store')->name('admin.mini.store');
        //编辑
        Route::get('edit/{id}', 'MiniProgramController@edit')->name('admin.mini.edit');
        Route::put('update/{id}', 'MiniProgramController@update')->name('admin.mini.update');
        //删除
        Route::delete('destroy', 'MiniProgramController@destroy')->name('admin.mini.destroy');
    });

    //小程序页面
    Route::prefix('mini/page')->group(function () {
        Route::get('data', 'MiniProgramPageController@data')->name('admin.mini.page.data');
        Route::get('/', 'MiniProgramPageController@index')->name('admin.mini.page');
        //添加
        Route::get('create', 'MiniProgramPageController@create')->name('admin.mini.page.create');
        Route::post('store', 'MiniProgramPageController@store')->name('admin.mini.page.store');
        //编辑
        Route::get('edit/{id}', 'MiniProgramPageController@edit')->name('admin.mini.page.edit');
        Route::put('update/{id}', 'MiniProgramPageController@update')->name('admin.mini.page.update');
        //删除
        Route::delete('destroy', 'MiniProgramPageController@destroy')->name('admin.mini.page.destroy');
    });

});

Route::get('demo/table/user/',function (){
    return [
        'code'=>0,
        'count'=>4,
        'msg'=>'',
        'data'=>[
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
            [
                'id'=>100,
                'username'=>'username',
                'city'=>'city',
                'classify'=>'username',
                'experience'=>'experience',
                'logins'=>'username',

                'score'=>'username',
                'sex'=>'experience',

                'sign'=>'experience',
                'wealth'=>'username',
            ],
        ],
    ];
});